#include "stack.h"
#include <iostream>
bool Stack::isFull() const
{
    if (totalNum >= MAX_ITEM)
    {
        return true;
    }
    return false;
}

bool Stack::isEmpty() const
{
    if (totalNum == 0)
    {
        return true;
    }
    return false;
}

bool Stack::push(const Item &item) 
{
    if (isFull())
    {
        return false;
    }
    
    items[totalNum] = item;
    totalNum += 1;
    return true;
}

void Stack::pop( Item &item)
{
    if (isEmpty())
    {
        using namespace std;
        cout << "Current stack is empty." << endl;
        return;
    }
    item = items[totalNum];
    totalNum = totalNum -1;
}

void Stack::display()
{
    using namespace std;
    for (size_t i = 0; i < totalNum; i++)
    {
        cout << i << "'s item: " << items[i] << endl;
    }
}


